package com.itheima.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itheima.dao.StudentDao;
import com.itheima.domain.Student;
import com.itheima.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService{

    @Autowired
    private StudentDao studentDao;

    @Override//增加
    public boolean saveStu(Student student) {
        return studentDao.saveStu(student);
    }

    @Override//修改
    public boolean updateStu(Student student) {
        return studentDao.updateStu(student);
    }

    @Override//删除
    public boolean deleteStu(Integer uuid) {
        return studentDao.deleteStu(uuid);
    }

    @Override//单个查询
    public Student getStu(Integer uuid) {
        return studentDao.getStu(uuid);
    }

    @Override//分页查询
    public PageInfo<Student> getAllStu(int page, int size) {
        PageHelper.startPage(page, size);
        List<Student> all = studentDao.getAllStu();
        return new PageInfo<Student>(all);
    }
}
